package io.renren.modules.basic.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.basic.entity.ByErptowmsEntity;
import io.renren.modules.basic.service.ByErptowmsService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-10-14 10:46:42
 */
@RestController
@RequestMapping("generator/byerptowms")
public class ByErptowmsController {
    @Autowired
    private ByErptowmsService byErptowmsService;

    /**
     * 列表
     */
    @ApiOperation(value = "erpToWms中间表",notes = "erpToWms中间表")
    @RequestMapping("/list")
    @RequiresPermissions("generator:byerptowms:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = byErptowmsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:byerptowms:info")
    public R info(@PathVariable("id") Integer id){
		ByErptowmsEntity byErptowms = byErptowmsService.getById(id);

        return R.ok().put("byErptowms", byErptowms);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:byerptowms:save")
    public R save(@RequestBody ByErptowmsEntity byErptowms){
		byErptowmsService.save(byErptowms);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:byerptowms:update")
    public R update(@RequestBody ByErptowmsEntity byErptowms){
		byErptowmsService.updateById(byErptowms);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:byerptowms:delete")
    public R delete(@RequestBody Integer[] ids){
		byErptowmsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
